import java.util.Enumeration;
import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.Vector;

class P10126 {

	static boolean first = true;
	
	public static void main(String[] args) {
		try {
		while (true) {
			int n = getN();
			
			if (n != -1) {
				if (!first) {
					System.out.println();
					
				}
				first = false;
				process(n);
			} else {
				break;
			}
		}
		} catch (Exception e) {
			while (true) {
				
			}
		}
	}


	private static int getN() {
		String line = readLn1();
		while (line != null) {
			if (!line.equals("")) {
				return Integer.parseInt(line);
			}
			line = readLn1();
		} 
		return -1;
	}


	private static void process(int n) {
		Hashtable table = new Hashtable();

		String line = readLn();
		while (!"EndOfText".equals(line)) {
			StringTokenizer st = new StringTokenizer(line);
			while (st.hasMoreTokens()) {
				String word = st.nextToken().toUpperCase();

				Integer counter = (Integer) table.get(word);
				if (counter == null) {
					counter = new Integer(0);
				}
				counter = new Integer(counter.intValue() + 1);
				table.put(word, counter);

			}
			line = readLn();
		}

		Vector words = new Vector();
		Enumeration keys = table.keys();

		while (keys.hasMoreElements()) {
			String word = (String) keys.nextElement();
			if (((Integer) table.get(word)).intValue() == n) {
				words.addElement(word);
			}
		}

		if (words.size() == 0) {
			System.out.println("There is no such word.");
		} else {
		
			sort(words);
		
			int length = words.size();
	
			for (int k = 0; k < length; k++) {
				System.out.println(((String) words.elementAt(k)).toLowerCase());
			}
		}
		

	}


	private static void sort(Vector words) {
		quickSortWords(words, 0, words.size() - 1);
	}


	private static void quickSortWords(Vector vector, int i, int j) {
		if (i < j) {
			int q = partition(vector, i, j);
			quickSortWords(vector, i, q - 1);
			quickSortWords(vector, q + 1, j);
		}
	}


	private static int partition(Vector vector, int p, int r) {
		String x = (String) vector.elementAt(r);
		int i = p - 1;
		for (int j = p; j < r; j++) {
			if (((String) vector.elementAt(j)).compareTo(x) <= 0) {
				i = i + 1;
				swap(vector, i, j);
			}
		}
		swap(vector, i + 1, r);
		return i + 1;
	}


	private static void swap(Vector vector, int i, int r) {
		String aux = (String) vector.elementAt(i);
		vector.setElementAt(vector.elementAt(r), i);
		vector.setElementAt(aux, r);
	}

	static String readLn1() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {

				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

	

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {

				if ((car >= 'A' && car <= 'Z') || (car >= 'a' && car <= 'z')) {
					buffer.append((char) car);
				} else {
					buffer.append(' ');
				}
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}


	
}
